<?
require_once 'config.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>	
	<title>Đăng nhập</title>
	<meta name="google-site-verification" content="gkB9RQiF61Fg779oj1do-N0_IcXutfYartJIAF7Dbtw" />
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta property="og:image" content=""/>
   <meta name="description" content="" />
   <meta name="keywords" content="" />
	<link type="image/x-icon" href="/favicon_home.ico" rel="icon" />
	<link rel="SHORTCUT ICON" href="/favicon_home.ico"/>   
   <link rel="stylesheet" type="text/css" href="../themes/css/base.css"/>
   <link rel="stylesheet" type="text/css" href="../themes/css/login.css"/>
   
   <script type="text/javascript" src="../themes/js/jquery.js"></script>
    <?=$analytics?>
</head>
<body>
   <div class="globalContainer">
      <?
         include('view/common/vic_header.php');
      ?>
      <div class="line"></div>
      <div class="massseo_login w1136">
         <div class="login_wrap">
            <div class="login">
            <?
               $action				= getValue("action", "str", "POST", "");
               $time					=	0;
               $msgError			=	"";
               //Lấy ra link continue nếu có
               $url_continue = get_link_redirect();
               if($myuser->logged()){
                   redirect($url_continue);
               }
               if($action == 'action'){
               	$username			= getValue("username", "str", "POST", "", 1);
               	$password			= getValue("password", "str", "POST", "", 1);
               	$remember			= getValue("remember_me", "int", "POST", 0);
               	if($remember 		==	 0){
               		$time				=	time() + (1 * 86400);
               	}else{
               		$time				=	time() + (365 * 86400);
               	}
               	$myuser = new user($username, $password);
               	
               	$myuser->savecookie($time);
               
               	if($myuser->logged() != 1){
               		$msgError = "<p style='color:red'>Tài khoản đăng nhập hoặc mật khẩu không đúng ! Xin vui lòng nhập lại.</p>";
               	}else{
               
                       if($url_continue){
                           redirect($url_continue);
                       }else{
                           redirect('/');
                       }
               	}
               }
            ?>
            <?=$msgError?>
               <p class="login_title">ĐĂNG NHẬP</p>
               <form action="" method="post">
               <input type="hidden" name="action" value="action" />
                  <div class="input_wrap">
                     <div class="input_inner">
                        <input name="username" placeholder="Email"/>
                     </div>
                  </div>
                  <div class="input_wrap">
                     <div class="input_inner">
                        <input type="password" name="password" placeholder="Mật khẩu"/>
                     </div>
                  </div>
                  <div class="remember_forget">
                     <div class="remember_me_wrap">
                        <label><input type="checkbox" name="remember_me" value="1"/><span>&nbsp;Nhớ tài khoản</span></label>
                     </div>
                     <a href="/quen-mat-khau.html">Quên mật khẩu?</a>
                  </div>
                  <div class="login_submit_wrap">
                     <input type="submit" class="login_submit" value="Đăng nhập" />
                  </div>
               </form>
            </div>
            <div class="notifi">
               <a href="#">Đăng ký miễn phí</a><span> để trở thành CTV kinh doanh của MassSEO.vn</span>
            </div>
         </div>
      </div>
      <div class="line"></div>
      <?
         include('view/common/vic_footer.php');
      ?>
   </div>
</body>
</html>